use common::app_config::Config;
use log4rs::append::file;

use std::path::{Path, PathBuf};
pub fn init_app_config(log:&str, app:&str) -> Config{

    let file_path = file!();
    println!("file: {:?}", file_path);

    let file_path = Path::new(file_path);

    let parent_dir = file_path.parent().unwrap().parent().unwrap();

    let log_path = parent_dir.join(log);

    log4rs::init_file(log_path.to_str().unwrap(), Default::default()).unwrap();
    //let app_config_path = "../conf/app.yaml";
    
    let app_path = parent_dir.join(app);

    let appconfig:Config = Config::init(app_path.to_str().unwrap());
    appconfig
}
